Skip to content

Keep Graphics Capture on the UI thread and bump to 1.0.2 - #70

Merged
marcosqlbi merged 1 commit into
mainfrom
fix/liveview-store-dispatcher-queue
Aug 25, 2026
Merged

Keep Graphics Capture on the UI thread and bump to 1.0.2#70
marcosqlbi merged 1 commit into
mainfrom
fix/liveview-store-dispatcher-queue

Conversation

@marcosqlbi

Copy link
Copy Markdown
Collaborator

1.0.1 still crashed in the Store with AccessViolationException from IObjectReference.Finalize (0xC0000005). Disposing the session and frame fields was not enough.

Two RCWs were still left for the GC, and both match create-LiveView-then-resize:

  • GraphicsCapturePicker is not IDisposable. The pick method allocated it and dropped it. Resize allocates, GC runs, the finalizer Marshal.Releases off the UI apartment.
  • CreateFreeThreaded built frames on a worker. Rate-limiting disposed most of those wrappers on that worker. In a packaged process they are apartment-bound.

Create a WinRT DispatcherQueue on the WPF UI thread and hold the native controller for the process lifetime. Switch the frame pool to Create so FrameArrived stays on that thread. Release every capture RCW there, including the picker.

VersionPrefix is 1.0.2 so this can go to the Store (identity 1.0.2.0).

Verified locally: dotnet build Whiteboard.sln -c Release is clean, Core smoke tests pass. Confirmation is still a packaged install on a machine that crashed on 1.0.1; the portable ZIP never hit this path.

1.0.1 still crashed in the Store with AccessViolationException from
IObjectReference.Finalize. Disposing session and frame fields was not
enough: GraphicsCapturePicker was abandoned after the pick, and
CreateFreeThreaded built frame RCWs on a worker. Resize triggered GC
and Marshal.Release ran off the apartment.

Create a WinRT DispatcherQueue on the WPF UI thread, switch the frame
pool to Create so FrameArrived stays there, and Release every capture
RCW on that thread, including the picker. VersionPrefix is 1.0.2.
@marcosqlbi
marcosqlbi merged commit ff5bfba into main Aug 25, 2026
4 checks passed
@marcosqlbi
marcosqlbi deleted the fix/liveview-store-dispatcher-queue branch August 25, 2026 10:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant